Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upstream: premature connection destruction fix #7728

Conversation

leonardo-albertovich
Copy link
Collaborator

This PR addresses an issue caused by flb_upstream_conn_timeouts when a connection times out in a cycle where FLB_ENGINE_LOOP_MAX_ITER is exceeded.

What this means is the priority event loop will defer processing of the event for the next overall iteration which happens after flb_upstream_conn_pending_destroy_list is invoked by the thread which results in a coroutine being left suspended indefinitely.

The main issue was that flb_upstream_conn_timeouts immediately performed most of the connection disposal and marked the connection to be reaped at the end of the cycle.

In order to prevent this while retaining some of the required functionality we now only perform the connection shutdown and inject an event in order to force the engine to resume the coroutine as soon as possible.

Additionally, a flag to ensure that a socket is only shut down once
has been added and the timeout based event injection and connection
destruction mechanism was refactored to ensure that connections aren't
prematurely destroyed and coroutines are properly resumed even when
the priority event loop hits its iteration limit before the injected
event is processed.

Signed-off-by: Leonardo Alminana <[email protected]>
@edsiper
Copy link
Member

edsiper commented Jul 24, 2023

The logic of the code seems good to me.

@edsiper edsiper merged commit 720365a into master Jul 24, 2023
@edsiper edsiper deleted the leonardo-master-upstream-timeout-premature-connection-destruction-fix branch July 24, 2023 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants